import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { AppUserVO, AppUserForm, AppUserQuery } from '@/api/system/appUser/types';

/**
 * 查询用户信息列表
 * @param query
 * @returns {*}
 */

export const listAppUser = (query?: AppUserQuery): AxiosPromise<AppUserVO[]> => {
  return request({
    url: '/system/appUser/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询用户信息列表
 * @param query
 * @returns {*}
 */

export const getAppUserList = (): AxiosPromise<AppUserVO[]> => {
  return request({
    url: '/system/appUser/getAppUserList',
    method: 'get',
  });
};

/**
 * 查询用户信息详细
 * @param appUserId
 */
export const getAppUser = (appUserId: string | number): AxiosPromise<AppUserVO> => {
  return request({
    url: '/system/appUser/' + appUserId,
    method: 'get'
  });
};

/**
 * 新增用户信息
 * @param data
 */
export const addAppUser = (data: AppUserForm) => {
  return request({
    url: '/system/appUser',
    method: 'post',
    data: data
  });
};

/**
 * 修改用户信息
 * @param data
 */
export const updateAppUser = (data: AppUserForm) => {
  return request({
    url: '/system/appUser',
    method: 'put',
    data: data
  });
};

/**
 * 删除用户信息
 * @param appUserId
 */
export const delAppUser = (appUserId: string | number | Array<string | number>) => {
  return request({
    url: '/system/appUser/' + appUserId,
    method: 'delete'
  });
};


/**
 * 获取技师客户信息（档案信息）
 * @param id
 */
export const getJsCustomer = (id: string | number): AxiosPromise<any> => {
  return request({
    url: '/system/appUser/getJsCustomerId/' + id,
    method: 'get'
  });
};

/**
 * 获取技师评价客户的记录
 * @param id
 */
export const getEvaluateCustomerId = (id: string | number): AxiosPromise<any> => {
  return request({
    url: '/system/accountantEvaluate/getEvaluateCustomerId/' + id,
    method: 'get'
  });
};
